package com.kangye.learnstudent.controller;

import com.kangye.learnstudent.entity.Subject;
import com.kangye.learnstudent.entity.Video;
import com.kangye.learnstudent.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * @program: learndeduo
 * @description: 视频请求接口
 * @author: 高天乐
 * @create: 2021-05-17 14:09
 **/
@RestController
@CrossOrigin
@RequestMapping("/video")
public class VideoController {
    //注入 VideoService接口 调用里面的方法
    @Autowired
    public VideoService videoService;

    @RequestMapping("/videoList")
    public List<Video> VideoList(String subjectName){
//        System.out.println("123");
//        //通过videoService调用接口里面的VideoList方法 然后返回一个list类型
//        List<Subject> videos = videoService.VideoList(subject);
        //判断 videos等于几 把数据显示出来
        if (subjectName.equals(subjectName)){
            return videoService.VideoList(subjectName);

        }

        return null;
    }

    @RequestMapping("/videoList1")
    public List<Video> VideoList(){
//        System.out.println("123");
//        //通过videoService调用接口里面的VideoList方法 然后返回一个list类型
//        List<Subject> videos = videoService.VideoList(subject);
        //判断 videos等于几 把数据显示出来
        return videoService.vido();
    }


    @RequestMapping("/subjectNameList")
    public List<Subject> subjectNameList(){

        return videoService.subjectNameList();
    }

}
